package com.tools;

import java.sql.Connection;
import java.sql.SQLException;

import javax.sql.DataSource;

import com.mchange.v2.c3p0.ComboPooledDataSource;


/**
 * jdbc小工具，生成一个Connection对象，生成DataSource对象
 * 实现原理：使用c3p0连接池获得Connection对象
 * version1.1
 * @author lovemanai
 *
 */
public class JdbcUtils {
	
	private static ComboPooledDataSource dataSource = new ComboPooledDataSource();
	
	public static Connection getConnection() throws SQLException {
		//获得连接
		Connection conn = dataSource.getConnection(); 
		return conn;
	}
	
	public static DataSource getDataSource() {
		return dataSource;
	}
}
